#pragma once

#include <vector>
#include <string>
#include <iostream>
#include <memory>

class WordReport {
public:
    static std::shared_ptr<WordReport> Create();
    virtual void Print(const std::vector<std::string>& words) = 0;
    virtual void Calculate(const std::vector<std::string>& words) = 0;
    virtual std::string GetSummary() = 0;
    virtual void Clear() = 0;
public:
    virtual ~WordReport() {}
};

class TextReport : public WordReport {
public:
    void Print(const std::vector<std::string>& words) override;
    std::string GetSummary() override;
    void Calculate(const std::vector<std::string>& words);
    void Clear() override {
        std::cout<<"TextReport::Clear()"<<std::endl;
        m_words.clear();
        summarize.clear();
    }

private:
    void SortWords();

protected:
    std::vector<std::string> m_words;
    std::string summarize;
};